<template>
  <el-form-item :label="item.label" :prop="item.key" :labelWidth="item.labelWidth || labelWidth">
    <el-input-number
      class="w"
      v-model="formData[item.key]"
      :min="item.min"
      :max="item.max"
      :placeholder="item.placeholder|| `请输入${item.label}`"
      :disabled="item.disabled"
      :size="item.size"
      :controls="item.controls"
      :controls-position="item.controlsPosition"
      :readonly="item.readonly"
      :validateEvent="item.validateEvent"
      @keyup.enter.native="txtChange"
    />
  </el-form-item>
</template>

<script setup lang="ts">
const { formData, item } = defineProps({
  formData: Object,
  item: Object,
})
const emit = defineEmits(['update:name', 'txtChange'])

const txtChange = (val) => {
  emit('txtChange', val)
}
</script>

<style scoped lang="scss">
:deep(.el-input-number) {
  .el-input__inner {
    text-align: left;
  }
}
</style>
